package com.linkage.seapeak.pojo;

import org.json.JSONObject;

import java.io.Serializable;

public class UploadImage implements Serializable {

    /**
     * filename : pic.jpg
     * filepath : group1/M00/00/06/wKgBR1zRRDKAYaSlAADZulspW1k900.jpg
     * loadUrl : http://58.209.223.28:8888/group1/M00/00/06/wKgBR1zRRDKAYaSlAADZulspW1k900-wmark
     * .jpg?token=f11f0314b0c1491e6bf937210c7e8d67&ts=1557218354
     * filesize : 55738
     */

    private String filename;
    private String filepath;
    private String loadUrl;

    public String getRealSourceUrl() {
        return realSourceUrl;
    }

    public void setRealSourceUrl(String realSourceUrl) {
        this.realSourceUrl = realSourceUrl;
    }

    private String realSourceUrl;
    private int filesize;

    public String getFilename() {
        return filename;
    }

    public void setFilename(String filename) {
        this.filename = filename;
    }

    public String getFilepath() {
        return filepath;
    }

    public void setFilepath(String filepath) {
        this.filepath = filepath;
    }

    public String getLoadUrl() {
        return loadUrl;
    }

    public void setLoadUrl(String loadUrl) {
        this.loadUrl = loadUrl;
    }

    public int getFilesize() {
        return filesize;
    }

    public void setFilesize(int filesize) {
        this.filesize = filesize;
    }


    @Override
    public String toString() {
        return "UploadImage{" +
                "filename='" + filename + '\'' +
                ", filepath='" + filepath + '\'' +
                ", loadUrl='" + loadUrl + '\'' +
                ", realSourceUrl='" + realSourceUrl + '\'' +
                ", filesize=" + filesize +
                '}';
    }

    public JSONObject parse2JSON() {
        JSONObject obj = new JSONObject();
        try {
            obj.putOpt("filename", filename);
            obj.putOpt("filepath", filepath);
            obj.putOpt("filesize", filesize);
            obj.putOpt("realSourceUrl",realSourceUrl);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return obj;
    }
}
